<?php namespace web\home\controller;

/** .-------------------------------------------------------------------
 * |  Software: [HDPHP framework]
 * |      Site: www.hdphp.com
 * |-------------------------------------------------------------------
 * |    Author: 向军 <2300071698@qq.com>
 * |    WeChat: aihoudun
 * | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
 * '-------------------------------------------------------------------*/

class Entry extends Common{
	//首页
	public function index() {
		//title标签数据
		$conf = ['title'=>'刘超群博客'];
		View::with('conf',$conf);
		$page = Page::row(3)->make(Db::table('article')->where('is_recycle',1)->count());
//		p($page);
		$articleData = Db::table('article')
			->join('category','category_cid','=','cid')->where('is_recycle',1)->limit(Page::limit())->get();
//		p($articleData);
		foreach ($articleData as $k => $v){
			$articleData[$k]['tag'] = Db::table('article_tag')->join('tag','tag_tid','=','tid')->where('article_aid',$v['aid'])->field(['tid','tname'])->get();
		}
//		p($articleData);
        View::with('page',$page);
        View::with('articleData',$articleData);
		View::make();
	}
}